<?php include("../../config/config.php"); 
//For Login
if(isset($_POST['login'])&&($_POST['login']=="Access your Account")){ //print_r($_POST); die();
	$chk=mysql_query("SELECT * FROM `my_csr` WHERE `username`='". mysql_real_escape_string(trim($_POST['username']))."' and `password`='". mysql_real_escape_string(trim(md5($_POST['password'])))."' and `status`=1 ")or die(mysql_error());	
	if(mysql_num_rows($chk)){
		$rows=mysql_fetch_array($chk);
		$_SESSION['csr_id']=	$rows['id'];
		$_SESSION['username']=	$rows['username'];
		$_SESSION['roll']=	$rows['roll'];
		//$_SESSION['msg']="Thankq You have Suscessfully Loged In";
		header("location:home.php"); exit;
	}else{
		$_SESSION['msg']="Invalid Email id and Password!!!";
		header("location:".$_SERVER['HTTP_REFERER']); exit;
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <link rel="stylesheet" href="css/stylesheet.css" type="text/css" charset="utf-8" /> 
	<title>My City Dial</title> 
 </head>
<style>
.login {
	width: 400px;
	border: 2px solid #ededed;
	border-radius: 15px;
	margin: 10% auto;
	padding: 20px;
}
.login h2 {
	font-size: 30px;
}
.login ul {
	width: auto;
	clear: both;
	margin-top: 10px;
}
.login ul li {
	float: left;
	display: inline;
}
.login ul li:first-child {
	margin-right: 20px;
}
.login ul li input[type=text], input[type=email], input[type=password] {
	background: #fcfcfc;
	border: 1px solid #cecece;
	padding: 5px;
	width: 150px;
}
.button {
	width: 100%;
	padding: 10px;
	margin-top: 20px;
	color: #FFF;
	background: #538f06;
	border: none;
	border-radius: 10px;
	cursor: pointer;
}
</style>
<body>

 
<form action="" method="post"  autocomplete="off">
<div class="login"> 
<?php if(isset($_SESSION['msg'])){?>
<div style=" text-align:center; color:#F00; font-size:16px;"><?php echo $_SESSION['msg']; unset($_SESSION['msg']); ?></div>
<?php }?>
<h2>Login Your Account</h2>

<ul>
 <li><input type="text" name="username" value="" placeholder="Username" required/> </li>
  <li><input type="password" name="password" value="" placeholder="Password"   required/> </li>
</ul>
<input type="submit" class="button" name="login" value="Access your Account"  />
</div> 
</div>
</form>
 
 





</body>
</html>
